//
//  YGTimeTableViewCell.m
//  yuanshangyiliao
//
//  Created by icholab on 2021/3/22.
//

#import "YGTimeTableViewCell.h"

@interface YGTimeTableViewCell ()
@property (nonatomic, strong) UILabel *timeLabel;

@end
@implementation YGTimeTableViewCell


- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self initView];
        [self initContraints];
    }
    return self;
}

- (void)initView{

    [self addContentView:self.timeLabel];

}

- (void)setPlaceHolder:(NSString *)placeholder{
    self.timeLabel.text = placeholder;
    self.timeLabel.textColor = UIColorFromRGBAlpha(0x333333, 0.5);
}

- (void)configureData:(YGRegisterConfigureModel *)infoModel{
    if (infoModel.time) {
        self.timeLabel.text = infoModel.time;
        self.timeLabel.textColor = UIColorFromRGB(0x333333);
    }
   
}

- (void)clickTimeAction{
    if (self.CallBack) {
        self.CallBack(nil, self.tag);
    }
}

- (void)initContraints{
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(28);
        make.width.mas_equalTo(135);
        make.left.mas_equalTo(self.contentSuperView.mas_left);
        make.centerY.mas_equalTo(self.contentSuperView.mas_centerY);
    }];
    
}

- (UILabel *)timeLabel{
    if (!_timeLabel) {
        _timeLabel = [[UILabel alloc] init];
        _timeLabel.font = [UIFont systemFontOfSize:14];
        _timeLabel.userInteractionEnabled = YES;
        _timeLabel.layer.borderWidth = 0.5;
        _timeLabel.clipsToBounds = YES;
        _timeLabel.layer.cornerRadius = 4;
        _timeLabel.layer.borderColor = UIColorFromRGB(0x333333).CGColor;
        
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickTimeAction)];
        [_timeLabel addGestureRecognizer:tap];
    }
    return _timeLabel;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
